<!--
/*
 ************************************************************************************
 * Copyright (C) 2001-2011 encuestame: system online surveys Copyright (C) 2011
 * encuestame Development Team.
 * Licensed under the Apache Software License version 2.0
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to  in writing,  software  distributed
 * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
 * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
 * specific language governing permissions and limitations under the License.
 ************************************************************************************
 */
 -->
<ehcache>
    <!-- Cache configuration file. If a cache is created and isn't listed in
        this file, EHCache will log a complaint -->

    <!-- All caches are configured not to overflow to disk, but we have to set
        this just in case -->

    <!--Default Cache configuration. These will applied to caches programmatically created through
        the CacheManager.

        The following attributes are required for defaultCache:

        maxInMemory       - Sets the maximum number of objects that will be created in memory
        eternal           - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element
                            is never expired.
        timeToIdleSeconds - Sets the time to idle for an element before it expires.
                            i.e. The maximum amount of time between accesses before an element expires.
                            Is only used if the element is not eternal.
        timeToLiveSeconds - Sets the time to live for an element before it expires.
                            i.e. The maximum time between creation time and when an element expires.
                            Is only used if the element is not eternal.
        overflowToDisk    - Sets whether elements can overflow to disk when the in-memory cache
                            has reached the maxInMemory limit.

     -->
    <defaultCache eternal="true" maxElementsInMemory="100" overflowToDisk="false" />

    <!-- Cache Directory. -->

    <diskStore path="java.io.tmpdir" />

    <!-- Web Cache -->

    <cache name="SimplePageCachingFilter"
           maxElementsInMemory="10000"
           maxElementsOnDisk="1000"
           eternal="false"
           overflowToDisk="true"
           timeToIdleSeconds="300"
           timeToLiveSeconds="600"
           memoryStoreEvictionPolicy="LFU"/>

    <!-- Domain Cached. -->

    <cache name="userAccountById" maxElementsInMemory="10" eternal="false"
        overflowToDisk="false" />
    <cache name="userByUsername" maxElementsInMemory="10" eternal="false"
        overflowToDisk="false" />
    <cache name="org.encuestame.persistence.domain.security.UserAccount"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache
        name="org.encuestame.persistence.domain.security.UserAccount.secUserPermissions"
        maxElementsInMemory="450" eternal="false" timeToLiveSeconds="600"
        overflowToDisk="true" />
    <cache
        name="org.encuestame.persistence.domain.security.UserAccount.followers"
        maxElementsInMemory="450" eternal="false" timeToLiveSeconds="600"
        overflowToDisk="true" />
    <cache name="query.user.by.username"
            maxElementsInMemory="60"
            eternal="false"
            overflowToDisk="false"
            timeToIdleSeconds="300"
            timeToLiveSeconds="600"
        />
    <cache
        name="org.encuestame.persistence.domain.security.UserAccount.projects"
        maxElementsInMemory="450" eternal="false" timeToLiveSeconds="600"
        overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.security.Account"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.security.Permission"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.question.Question"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.tweetpol.TweetPoll"
        maxElementsInMemory="500" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.tweetpol.TweetPollFolder"
        maxElementsInMemory="100" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.tweetpol.TweetPollResult"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.tweetpol.TweetPollSwitch"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.survey.Poll"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.survey.PollFolder"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.dashboard.Gadget"
        maxElementsInMemory="100" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.dashboard.GadgetProperties"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.dashboard.Dashboard"
        maxElementsInMemory="100" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.HashTag"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />
    <cache name="org.encuestame.persistence.domain.HashTagHits"
        maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
        timeToLiveSeconds="600" overflowToDisk="true" />

    <!-- Spring ehcache annotations -->
    <cache name="searchUserByUsername" maxElementsInMemory="10" eternal="false" overflowToDisk="false" />

</ehcache>